//
//  DQSetViewController.m
//  DrivingQuestionBank
//
//  Created by 上榜 on 2024/1/3.
//

#import "DQSetViewController.h"
#import "DQAboutViewController.h"
#import "DQSiMiViewController.h"
#import "DQFanKuiViewController.h"


@interface DQSetViewController ()<UITableViewDelegate, UITableViewDataSource>
@property(nonatomic, strong) UITableView *setCenterTableView;
@property (nonatomic, strong) NSArray *titleArr;
@property (nonatomic, strong) NSArray *iconArr;
@property (nonatomic, strong) NSArray *detailArr;
@end

@implementation DQSetViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    
    self.titleArr = @[@"宝贵意见",@"隐私政策",@"关于我们",@"当前版本",@"清理缓存"];
    self.iconArr = @[@"",@"",@"",@"",@"",@""];
    self.detailArr = @[@"帮助我们找到问题所在",@"保护你的隐私信息",@"我们是一个怎样的APP",@"V1.0.0",@"一键清理"];
    
    
    self.setCenterTableView = [[UITableView alloc] initWithFrame:CGRectMake(0, 0, ScreenWidth, ScreenHeight) style:UITableViewStylePlain];
    self.setCenterTableView.delegate = self;
    self.setCenterTableView.dataSource = self;
    self.setCenterTableView.backgroundColor = [UIColor whiteColor];
    [self.setCenterTableView registerClass:[UITableViewCell class] forCellReuseIdentifier:@"dqset"];
    [self.view addSubview:self.setCenterTableView];
    
    
    
}

- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView {
    return 1;
}

- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
    return self.titleArr.count;
}

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
    UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"dqset" forIndexPath:indexPath];
    if(cell == nil) {
        cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:@"dqset"];
    }
    cell.textLabel.text = self.titleArr[indexPath.row];
    cell.imageView.image = [UIImage imageNamed:self.iconArr[indexPath.row]];
    cell.detailTextLabel.text = self.detailArr[indexPath.row];
    cell.selectionStyle = UITableViewCellSelectionStyleNone;
    cell.accessoryType = UITableViewCellAccessoryDisclosureIndicator;
    return  cell;
}

- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath{
    return 55;
}

- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath{
    switch (indexPath.row) {
        case 0:
        {
            DQFanKuiViewController *dq_fan = [[DQFanKuiViewController alloc] init];
            [self.navigationController pushViewController:dq_fan animated:YES];
            
        }
            break;
        case 1:
        {
            DQSiMiViewController *dq_simi = [[DQSiMiViewController alloc] init];
            [self.navigationController pushViewController:dq_simi animated:YES];
        }
            break;
        case 2:
        {
            DQAboutViewController *dq_about = [[DQAboutViewController alloc] init];
            [self.navigationController pushViewController:dq_about animated:YES];
        }
            break;
        case 3:
        {
            
        }
            break;
            
        default:
        {
            
        }
            break;
    }
}

@end
